package cn.clwxy.gdz.controller;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import cn.clwxy.gdz.bo.TeacherInfoBean;
import cn.clwxy.gdz.bo.TeacherInfoPageOrderListBean;
import cn.clwxy.gdz.service.TeacherInfoBeanService;
import cn.clwxy.gdz.service.TeacherInfoBeanServiceImpl;
import cn.clwxy.gdz.service.TeacherInfoPageOrderListBeanDao;
import cn.clwxy.gdz.service.TeacherInfoPageOrderListBeanDaoImpl;
import cn.clwxy.gdz.util.JsonSerializeHelper;

public class TeacherInfoOrderServlet extends HttpServlet {
		@Override
		protected void service(HttpServletRequest request, HttpServletResponse response)
				throws ServletException, IOException {
			request.setCharacterEncoding("utf-8");
			response.setCharacterEncoding("utf-8");
			Integer teacherId;
			try {
				teacherId = Integer.valueOf(request.getParameter("teacherId"));
			} catch (NumberFormatException e) {
				teacherId=0;
				e.printStackTrace();
			}
			
			
			
			TeacherInfoPageOrderListBeanDao teacherInfoPageOrderListBeanDao=new TeacherInfoPageOrderListBeanDaoImpl();
			List<TeacherInfoPageOrderListBean> orders=teacherInfoPageOrderListBeanDao.getTeacherInfoPageOrderListBeanByTeacherId(teacherId);
			System.out.println(orders);

			response.setContentType("application/json");
			String json = JsonSerializeHelper.JsonSerializer(orders);
			response.getWriter().write(json);
		}
}
